package com.wodan.zhongjinjicang.common.orm.bytesconverter.impl;

import com.wodan.zhongjinjicang.common.orm.bytesconverter.Converter;

import java.util.Date;



/**
 * 日期类型转换器
 * 
 * @ClassName: DateConverter
 * @Description: TODO
 * @author Administrator
 * @date 2015-1-10 下午3:50:41
 * @history
 * 
 */
public class DateConverter implements Converter {
	@Override
	public Object fromString(String str) {
		long millseconds = Long.parseLong(str);
		Date date = new Date(millseconds);
		return date;
	}

	@Override
	public String toString(Object obj) {
		Date date = (Date) obj;
		long time = date.getTime();
		return String.valueOf(time);
	}

	@Override
	public boolean isNullOrEmpty(Object obj) {
		if (obj == null) {
			return true;
		} else {
			return false;
		}
	}
}
